package com.richapp.launcher.scene.abstracts;

import android.util.Log;

import com.richapp.launcher.database.system.dao.DeviceModelDao;
import com.richapp.launcher.database.system.mode.DeviceModel;
import com.richapp.launcher.scene.SceneServer;
import com.richapp.launcher.scene.interfaces.ISceneAction;
import com.richapp.launcher.scene.interfaces.ISceneDevice;

public abstract class SceneAbstractAction implements ISceneAction, ISceneDevice {

	private static final String TAG = SceneAbstractAction.class.getName();
	private String boxCpuId = "0";
	private String deviceId = "00";
	private String deviceNumber = "00";
    private String way = "00";
    private String deviceName = "00";
	private String dimmingValue = "00";
	private int delayActionTime = 1;
	private int orderNumber=0;

	
	public SceneAbstractAction() {
		
	}

	public String getBoxCpuId() {
		return boxCpuId;
	}

	public void setBoxCpuId(String boxCpuId) {
		this.boxCpuId = boxCpuId;
	}

	public String getDeviceId() {
		return deviceId;
	}

	public void setDeviceId(String deviceId) {
		this.deviceId = deviceId;
	}

	public String getDeviceNumber() {
		return deviceNumber;
	}

	public void setDeviceNumber(String deviceNumber) {
		this.deviceNumber = deviceNumber;
	}
	
	public String getDimmingValue() {
		return dimmingValue;
	}

	public void setDimmingValue(String dimmingValue) {
		this.dimmingValue = dimmingValue;
	}
	
	public int getDelayActionTime() {
		return delayActionTime;
	}

	public void setDelayActionTime(int delayActionTime) {
		this.delayActionTime = delayActionTime;
	}

    public String getDeviceName() {
        return deviceName;
    }

    public void setDeviceName(String deviceName) {
        this.deviceName = deviceName;
    }

    public String getWay() {
        return way;
    }

    public void setWay(String way) {
        this.way = way;
    }

	public int getOrderNumber() {
		return orderNumber;
	}

	public void setOrderNumber(int orderNumber) {
		this.orderNumber = orderNumber;
	}

	@Override
	public DeviceModel getDevice() {
		DeviceModelDao dmd = new DeviceModelDao(SceneServer.getInstance().getContext());
		return dmd.getByCpuIdDeviceIdDeviceNumber(boxCpuId, deviceId, deviceNumber,way);
	}
	
	@Override
	public void doDelay() {
		if(delayActionTime > 0){
			try {
				Thread.sleep(delayActionTime);
			} catch (InterruptedException e) {
				Log.e(TAG, e.getMessage());
			}
		}

	}

	@Override
	public void doAction() {

	}
}
